package com.dime.basic.api.factory;

import com.dime.basic.api.RemoteOccupationcriterionService;
import com.dime.basic.api.domain.DimeBaseoccupationcriterion;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RemoteOccupationcriterionFallbackFactory implements FallbackFactory<RemoteOccupationcriterionService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteOccupationcriterionFallbackFactory.class);
    @Override
    public RemoteOccupationcriterionService create(Throwable throwable) {
        log.error("蝶美职业诊断标准调用失败:{}", throwable.getMessage());

        return new RemoteOccupationcriterionService()
        {
            @Override
            public R<List<DimeBaseoccupationcriterion>> getDimeBaseoccupationcriterionList(DimeBaseoccupationcriterion dimeBaseoccupationcriterion, String source) {
                return R.fail("查询职业诊断标准信息:" + throwable.getMessage());
            }


            @Override
            public R<List<DimeBaseoccupationcriterion>> getDimeBaseoccupationcriterionListByHarms(List<String> harmIds) {
                return R.fail("查询职业诊断标准信息:" + throwable.getMessage());
            }

        };
    }

}
